package com.iplatform.iplatformuser;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableSwagger2
@ComponentScan(basePackages = {"com.iplatform.iplatformuser","com.iplatform.commons"})
public class IplatformUserApplication  extends SpringBootServletInitializer {


    private static final Logger LOG = LoggerFactory.getLogger(IplatformUserApplication.class);

    public static void main(String[] args) {
        try {
            SpringApplication.run(IplatformUserApplication.class, args);
        } catch (Exception e) {
            if (!"org.springframework.boot.devtools.restart.SilentExitExceptionHandler$SilentExitException"
                    .equals(e.toString())) {
                LOG.error("", e);
            }
        }
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(IplatformUserApplication.class);
    }
}
